package com.drojian.presenter;

import com.drojian.MainActivity;
import com.drojian.entity.Goods;
import com.drojian.model.GoodsModel;
import com.drojian.model.IGoodsModel;
import com.drojian.view.IBaseView;
import com.drojian.view.IGoodsView;

import java.util.List;

public class GoodsPresenter<T extends IBaseView> {
    //IGoodsView iGoodsView;
    public IGoodsView iGoodsView;
    IGoodsModel iGoodsModel = new GoodsModel();

    public GoodsPresenter(MainActivity iGoodsView) {
        this.iGoodsView = iGoodsView;
    }


    public void fetch(){
        if(iGoodsView != null && iGoodsModel != null){
            iGoodsModel.loadGoodsData(new IGoodsModel.OnLoadListener() {
                @Override
                public void onComplete(List<Goods> goods) {
                    iGoodsView.showGoodsView(goods);
                }

                @Override
                public void onError(String msg) {

                }
            });
        }
    }


}
